<?php
	require '../biz/backend.php';

	class action extends backend
	{
		var $get_privilege_id = 95;

		function do_get()
		{
			$template = load( 'template', array( 'domain'=>'tpl.admin' ) );
			$cate_id = isset( $this->input['id'] ) ? $this->input['id'] : '';
			$rang = isset( $this->input['rang'] ) ? $this->input['rang'] : '';

			if ( $cate_id != '' )
			{
				$generate = load( 'biz.generate' );
				$ok = $generate->gen( array( 'cate_id' => $cate_id, 'rang' => $rang ) );
				$template->assign( 'gen_result', $ok );
			}

			if ( 'home' == $cate_id )
			{
				$generate = load( 'biz.generate' );
				$ok = $generate->gen_home();
				$template->assign( 'gen_result', $ok );
			}

			if ( 'other' == $cate_id )
			{
				$generate = load( 'biz.generate' );
				$ok = $generate->gen_other();
				$template->assign( 'gen_result', $ok );
			}

			$cate = load( 'biz.cate' );
			$data = $cate->getcatealllist();

			$template->assign( 'cate_data', $data );

			$template->assign( 'reference', isset( $this->input['reference'] ) ? urldecode( $this->input['reference'] ) : config( 'server.HTTP_REFERER' ) );

			echo $template->parse( 'generate_html.php' );
		}
	}

	$action = new action();
	$action->run();
?>